﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式之禅.工厂模式.工厂方法模式
{
    public abstract class Product
    {
        public abstract string Say();
    }

    public class ProductA : Product
    {
        public override string Say()
        {
            return "A";
        }
    }
    public class ProductB : Product
    {
        public override string Say()
        {
            return "B";
        }
    }


    public abstract class Creator
    {
        public abstract Product FactoryMethod();
    }

    public class ConcreteCreatorA : Creator
    {
        public override Product FactoryMethod()
        {
            return new ProductA();
        }
    }

    public class ConcreteCreatorB : Creator
    {
        public override Product FactoryMethod()
        {
            return new ProductB();
        }
    }

}
